#!/bin/bash

echo "正在断开所有 SSH 连接..."

# 列出当前连接
echo "当前连接:"
who

# 断开所有 pts 会话
for pts in $(who | grep pts | awk '{print $2}'); do
    echo "断开 $pts"
    sudo pkill -9 -t $pts
done

# 验证
echo -e "\n剩余连接:"
who 